import type { MultiTabsSetting } from '#/config';
import { computed } from 'vue';
import { AppStorage } from '@2/app/core/ioc';

export function useMultipleTabSetting() {
  // TODO-BaiHoo-Update: 更新初始化项目配置
  // const appStore = useAppStore();
  const multiTabsSetting = AppStorage.getProjectConfig().multiTabsSetting;
  const getShowMultipleTab = computed(() => multiTabsSetting.show);

  const getShowQuick = computed(() => multiTabsSetting.showQuick);

  const getShowRedo = computed(() => multiTabsSetting.showRedo);

  const getShowFold = computed(() => multiTabsSetting.showFold);

  const getAutoCollapse = computed(() => multiTabsSetting.autoCollapse);

  function setMultipleTabSetting(multiTabsSetting: Partial<MultiTabsSetting>) {
    AppStorage.setProjectConfig({ multiTabsSetting });
  }
  return {
    setMultipleTabSetting,
    getShowMultipleTab,
    getShowQuick,
    getShowRedo,
    getShowFold,
    getAutoCollapse,
  };
}
